preserve 
keep if S_pds==1 
 
capture drop sample
gen sample=(S_pds==1 & n_ud==1)
capture drop b_in_sample
bys b_id: egen b_in_sample=max(sample)    

capture drop n_b_sa
bys b_id b_in_sample: gen n_b_sa=_n

cap binscatter S_incl_sourcing_metric_b S_sourcing_metric_b_excl if n_b_sa==1 & b_in_sample==1,  ///
msymbol(oh) mcolor(black) graphregion(color(white)) ylab(,nogrid) ytitle("Sourcing in Included Products", size(small)) ///
 xtitle("Sourcing in Excluded Products", size(small)) lcolor(black) reportreg ///
 note("Slope: 0.332 (0.025)" "N=1,311", ring(0) pos(1) size(*0.65) box fcolor(white) lwidth(vvvthin) lcolor(grey))
graph export "${figures}\FigureD1.pdf", replace    
      
restore  